<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateRewardLogTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('reward_log', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->charset = 'utf8';
            $table->collation = 'utf8_general_ci';
            $table->increments('id');
            $table->integer('user_id')->comment('提交漏洞的用户');
            $table->integer('params')->comment('积分或者金币值');
            $table->integer('created_by')->comment('创建者');
            $table->integer('type')->comment('类型：1，金币；2，积分');
            $table->integer('app_id')->comment('应用id');
            $table->integer('vuld_id')->comment('漏洞id');
            $table->index('user_id','user_id_index');
            $table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('reward_log');
    }
}
